#pragma once


// CPropComboBox

class CPropComboBox : public CComboBox
{
public:
	CPropComboBox( CWnd* pParent, CRect& rt, int Item, LPCTSTR szCaption, WORD ID )
	{
		Create( CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP, rt, pParent, ID );
		ResetItem( Item, szCaption );
		ShowWindow( SW_SHOW );
	}

	void ResetItem( int Item, LPCTSTR szCaption )
	{
		while( DeleteString( 0 ) != CB_ERR );

		CString Str = szCaption;
		char* Buf = (char*)(LPCTSTR)Str;

		int PreItem = 0;
		int n = 0;
		for( int i = 0; i < 256; i++ )
		{
			if( Buf[i] == ',' )
			{
				Buf[i] = 0;
				InsertString( n, Buf + PreItem );
				n++;
				PreItem = i + 1;
			}
			else if( Buf[i] == 0 )
			{
				Buf[i] = 0;
				InsertString( n, Buf + PreItem );
				n++;
				PreItem = i + 1;
				break;
			}
		}

		SetCurSel( Item );
	}
};


